<!DOCTYPE html>

<html>
    <head>
        <script src="https://code.jquery.com/jquery-latest.min.js"></script>
        <script>

            $(document).ready(function() {

                $('#registration').submit(function() {

                    if ($('#registration input[name=email]').val() == '')
                    {
                        alert('missing email');
                        return false;
                    }
                    else if ($('#registration input[name=password]').val() == '')
                    {
                        alert('missing password');
                        return false;
                    }
                    else if ($('#registration input[name=password]').val() != $('#registration input[name=confirmation]').val()) 
                    {
                        alert('passwords don\'t match');
                        return false;
                    }
                    else if (!$('#registration input[name=agreement]').is(':checked')) 
                    {
                        alert('checkbox unchecked');
                        return false;
                    }
                    return true;

                });

            });

        </script>
        <title>form2</title>
    </head>
    <body>
        <form action="/register" id="registration" method="get">
            <input name="email" placeholder="Email" type="text"/>
            <input name="password" placeholder="Password" type="password"/>
            <input name="confirmation" placeholder="Password (again)" type="password"/>
            <input name="agreement" type="checkbox"/> I agree
            <input type="submit" value="Register"/>
        </form>
    </body>
</html>
